package cn.moukou.tongji.ihealth.doctor.service;


import cn.moukou.tongji.ihealth.doctor.dao.ImageMapper;
import cn.moukou.tongji.ihealth.doctor.pojo.Image;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ImageService {

    @Autowired
    ImageMapper imageMapper;


    public int saveImageUrl(String url, int label) {

        if(imageMapper.selectById(url)!=null) {
            return 1;
        }

        Image image = new Image();
        image.setUrl(url);
        image.setLabel(label);
        return imageMapper.insert(image);
    }

    public List<Image> randSelect() {
        return imageMapper.randSelect();
    }

}
